unit UMovConfiguracao;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, DBCtrls, DB, DBTables, UDPTOUteis;

type
  TFMovConfiguracao = class(TForm)
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label1: TLabel;
    Label2: TLabel;
    dbchkEXIBEATALHOS: TDBCheckBox;
    QConfiguracao: TQuery;
    DSConfiguracao: TDataSource;
    strngfldQConfiguracaoEXIBEATALHOS: TStringField;
    QConfiguracaoUSUCODIGO: TIntegerField;
    procedure FormCreate(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FMovConfiguracao: TFMovConfiguracao;

implementation

uses UPrincipal;

{$R *.dfm}

procedure TFMovConfiguracao.FormCreate(Sender: TObject);
var x:Integer;
begin
  for x:=1 to TForm(Self).ComponentCount - 1 do
  Begin
    if TForm(Self).Components[x].ClassType = TEdit then
    begin
       TEdit(TForm(Self).Components[x]).CharCase := ecUpperCase;
    end;

    if TForm(Self).Components[x].ClassType = TDbedit then
    begin
       TDbedit(TForm(Self).Components[x]).CharCase := ecUpperCase;
    end;

    if TForm(Self).Components[x].ClassType = TQuery then
    begin
       TQuery(TForm(Self).Components[x]).DatabaseName := DBNome;
    end;

  end;

  Label2.Caption := logado.UsuarioNome;

  //
  QConfiguracao.Close;
  QConfiguracao.SQL.Clear;
  QConfiguracao.SQL.Add('select * from GTRCONFIGURACAO WHERE'
   + ' USUCODIGO = ' + QuotedStr(IntToStr(Logado.UsuarioCodigo))
   );
   QConfiguracao.Open;

   //
   QConfiguracao.Edit;

  //

end;

procedure TFMovConfiguracao.BitBtn1Click(Sender: TObject);
begin
  if QConfiguracao.State = dsEdit then
  begin
     QConfiguracao.Post;
     Close;
  end;
end;

procedure TFMovConfiguracao.BitBtn2Click(Sender: TObject);
begin
  QConfiguracao.Cancel;
  Close;
end;

end.
